﻿using BoatNGoat.Logic.Map;
using SharpDX;

namespace BoatNGoat.Logic
{
    class MobFactory
    {
        private int _id = -1;

        public Goat MakeGoat(SpawnPoint spawn, IMap map)
        {
            MapMovementConstraint goatConstraint = new MapMovementConstraint(map)
                {
                    AllowedOnLand = true,
                    AllowedOnWater = false,
                    AllowedOnMountain = true
                };

            IMobBehaviour behaviour = new RandomWanderBehaviour();

            Goat goat = new Goat(NextId(), goatConstraint, behaviour)
                {
                    Position = (Vector2) spawn.MapPosition
                };

            return goat;
        }

        public PlayerMob MakePlayer(SpawnPoint spawn, IMap map)
        {
            MapMovementConstraint manConstraint = new MapMovementConstraint(map)
            {
                AllowedOnLand = true,
                AllowedOnWater = false,
                AllowedOnMountain = false
            };

            PlayerMob man = new PlayerMob(NextId(), manConstraint)
            {
                Position = (Vector2)spawn.MapPosition
            };

            return man;
        }

        private int NextId()
        {
            ++_id;
            return _id;
        }
    }
}
